<#--
生成实体的模板
-->
<@pp.dropOutputFile />
<#list project.entities as entity>
<@pp.changeOutputFile name="/test/unit/" + pathUrl(project.basepackage!) + "/service/" + entity.className + "ManagerTest.java" />
package ${project.basepackage}.service;

import org.springside.core.test.DaoTestCase;
import ${entity.package}.${entity.className};
<#setting datetime_format="yyyy-MM-dd HH:mm:ss">
/**
 *  ${entity.className}Manager的DAO CRUD 测试.
 * <p/>
 * 不需要对变量名作泛化了,一切自动生成.:)
 *
 * @author ${project.author}
 * ${pp.now}
 */
public class ${entity.className}ManagerTest extends DaoTestCase {

	private ${entity.className}Manager ${entity.className?lower_case}Manager;

	public void set${entity.className}Manager(${entity.className}Manager ${entity.className?lower_case}Manager) {
		this.${entity.className?lower_case}Manager = ${entity.className?lower_case}Manager;
	}

	public void testCRUD() {
		/*
		String name = "suwu";

		// 构造对象
		${entity.className} ${entity.className?lower_case} = new ${entity.className}();
		${entity.className?lower_case}.setName(name);

		// 保存对象
		${entity.className?lower_case}Manager.save(${entity.className?lower_case});
		// 保证id生成
		assertNotNull(${entity.className?lower_case}.getId());

		// 重新获得对象
		${entity.className?lower_case} = ${entity.className?lower_case}Manager.get(${entity.className?lower_case}.getId());
		// 保证能获取刚才保存的对象
		assertNotNull(${entity.className?lower_case});
		// 保证获取对象的属性值与保存时相同
		assertEquals(name, ${entity.className?lower_case}.getName());

		// 删除对象
		${entity.className?lower_case}Manager.remove(${entity.className?lower_case});
		try {
			${entity.className?lower_case}Manager.get(${entity.className?lower_case}.getId());
			fail("Entity found in database after deleted");
		} catch (Exception e) {
			assertNotNull(e.getMessage());
		}
		*/
	}
}
</#list>